<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ include file="admin_header.jsp"%>
<%@ include file="admin_container.jsp"%>
<%@ include file="admin_nav.jsp"%>
<script type="text/javascript" src="<c:url value="/js/word.js"/>"></script>

<br />
<br />
<a
	href="<c:url value="/administrator/wordlib.htm"><c:param name="method" value="displayOne"/><c:param name="wordLibID" value="${wordLibID }"/></c:url>">返回</a>

<c:if test="${word == null}">
	<h1>添加新单词</h1>
	<form
		action="<c:url value="/administrator/wordlib.htm?method=addWord"/>"
		method="post">
</c:if>
<c:if test="${word != null}">
	<form
		action="<c:url value="/administrator/wordlib.htm?method=editWord"/>"
		method="post">
	<h1>编辑单词</h1>
	<input name="wordID" type="hidden" value="${word.wordID }" />
</c:if>

<table>
	<tr>
		<td><label for="wordEn">英文单词:</label></td>
		<td><input type="text" name="wordEn" value="${word.wordEn}" /></td>
	</tr>
	<tr>
		<td><label for="phonetics">音标:</label></td>
		<td><input type="text" name="phonetics"
			value="${word.phonetics}" /></td>
	</tr>
	<tr>
		<td><label for="description">描述:</label></td>
		<td><textarea cols="30" rows="5" name="description">${wordLib.description}</textarea></td>
	</tr>
</table>

<div id="cs">
<ul>
	<c:if test="${word == null}">
		<li>
		<table>
			<tr>
				<td>中文含义:</td>
				<td><input type="text" name="cn"/></td>
			</tr>
			<tr>
				<td>例句:</td>
				<td><textarea name="cs"></textarea></td>
			</tr>
			<tr>
				<td><input type="hidden" name="csID" value="-1" /></td>
			</tr>
		</table>
		</li>
	</c:if>
	<c:if test="${word != null}">
		<c:forEach var="cs" items="${word.cnAndSentenceList}" varStatus="ss">
			<li id="cs${cs.csID }">
			<table>
				<tr>
					<td>中文含义:</td>
					<td><input type="text" name="cn" value="${cs.cn }"
						width="200" /></td>
				</tr>
				<tr>
					<td>例句:</td>
					<td><textarea name="cs">${cs.sentence }</textarea></td>
				</tr>
				<tr>
					<td><c:if test="${ss.index > 0 }">
						<a href="#" name="deleteCs">删除</a>
					</c:if> <input type="hidden" name="csID" value="${cs.csID }" /></td>
				</tr>
			</table>
			</li>
		</c:forEach>
	</c:if>
</ul>
</div>

<input id="submit" type="submit" value="保存单词信息" />
<a name="addCs" href="#">添加中文含义和例句</a>
<input name="wordLibID" type="hidden" value="${wordLibID }" />
</form>
<%@ include file="admin_footer.jsp"%>
